package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>
 * Title
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright (c) 2007
 * </p>
 * 
 * @author Andrew Carter
 * @version
 */

/**
 * Enumerates the permissible texture wrap modes.
 * 
 * @author Andrew Carter
 */
public enum E_TextureWM {

  /**
   * Wrapping modifier that clamps both the S and T values of the texture.
   */
  WM_CLAMP_S_CLAMP_T("WM_CLAMP_S_CLAMP_T", 0),

  /**
   * Wrapping modifier that clamps the S value but wraps the T value of the
   * texture.
   */
  WM_CLAMP_S_WRAP_T("WM_CLAMP_S_WRAP_T", 1),

  /**
   * Wrapping modifier that wraps the S value but clamps the T value of the
   * texture.
   */
  WM_WRAP_S_CLAMP_T("WM_WRAP_S_CLAMP_T", 2),

  /**
   * Wrapping modifier that wraps both the S and T values of the texture.
   */
  WM_WRAP_S_WRAP_T("WM_WRAP_S_WRAP_T", 3),

  /**
   * Wrapping modifier that clamps both the S and T values of the texture.  Uses CLAMP_TO_EDGE.
   */
  WM_ECLAMP_S_ECLAMP_T("WM_ECLAMP_S_ECLAMP_T", 4),

  /**
   * Wrapping modifier that clamps both the S and T values of the texture.  Uses CLAMP_TO_BORDER.
   */
  WM_BCLAMP_S_BCLAMP_T("WM_BCLAMP_S_BCLAMP_T", 5),

  /**
   * Wrapping modifier that uses a texture twice the size of the original image with the second half being a
   * mirrored image of the first.  Uses MIRRORED_REPEAT.
   */
  WM_MIRRORED_S_MIRRORED_T("WM_MIRRORED_S_MIRRORED_T", 6);
	
	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private int value;

	/**
	 * Private constructor.
	 * 
	 * @param value String literal of the enum
	 */
	private E_TextureWM(String name, int value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_TextureWM getConstant(String name) {

		for(E_TextureWM constant : E_TextureWM.values()) {

			if(constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_TextureWM getConstant(int type) {

		for(E_TextureWM constant : E_TextureWM.values()) {

			if(constant.getType() == type)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}

	/**
	 * Returns the integer value of the constant.
	 * 
	 * @return
	 */
	public int getType() {

		return value;
	}
}
